﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UtopianGame.graphics.menu;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace UtopianGame.graphics.menu
{
    class TextMenuButton : MenuButton
    {
        protected String message = "";

        public TextMenuButton()
        {
        }

        public TextMenuButton(ContentManager cm, String initialMessage)
        {
            init(cm, initialMessage);
        }

        protected override void init(ContentManager cm)
        {
            base.init(cm);
            spriteName = "button1";
            sprite = cm.Load<Texture2D>(spriteName);
            message = "";
            boundingBox.Width = ((int)GlobalDataHolder.baseFont.MeasureString(message).X) + 16;
            boundingBox.Height = ((int)GlobalDataHolder.baseFont.MeasureString(message).Y) + 16;
        }

        protected void init(ContentManager cm, String initialMessage)
        {
            base.init(cm);
            spriteName = "button1";
            sprite = cm.Load<Texture2D>(spriteName);
            message = initialMessage;
            boundingBox.Width = ((int)GlobalDataHolder.baseFont.MeasureString(message).X) + 16;
            boundingBox.Height = ((int)GlobalDataHolder.baseFont.MeasureString(message).Y) + 16;
        }

        public override void draw(SpriteBatch sb)
        {
            base.draw(sb);
            sb.DrawString(GlobalDataHolder.baseFont, message, new Vector2(boundingBox.X + 8, boundingBox.Y + 8), Color.Black);
        }

        protected override void executeFunction()
        {
           // if(message.Equals("Communication Screen")){
           // GlobalDataHolder.addGraphicalObject(new CommunicationScreen(contentManager, message), 128, 32);
       // }
            if (message.Equals("Policies"))
            {
                if (Nation.policyList.Count > 0)
                {
                    GlobalDataHolder.addGraphicalObject(new PolicyScreen(contentManager, message), 128, 32);
                }
            }
            if (message.Equals("Infrastructure"))
            {
                GlobalDataHolder.addGraphicalObject(new InfrastructureScreen(contentManager, message), 128, 32);
            }
    }
    
    }
}